#coding=utf-8
from django.db import models
from django.contrib.auth.models import User

# Create your models here.
    
class Member(models.Model):
    user            = models.ForeignKey(User, unique=True)
    nickname        = models.CharField('昵称', max_length = 32, blank = True, default = '')
    gender          = models.CharField('性别', max_length = 10, default = 'none')
    description     = models.CharField('描述', max_length = 512, blank = True)
    status          = models.CharField('状态', max_length = 32, default = 'active')
    followlist      = models.ManyToManyField(User, blank = True, null = True, verbose_name = '关注', related_name = 'followers') #只管单向的follow别人
    blacklist       = models.ManyToManyField(User, blank = True, null = True, verbose_name = '黑名单', related_name = 'banedlist') #黑名单用户列表
    
    def __unicode__(self):
        return '%s' % (self.user.username)
        
    def get_absolute_url(self):
        return "/u/%s/" % self.user.username
    
    class Meta:
        verbose_name_plural = '用户'
